var express = require('express');
var session = require('express-session');
var bodyParser = require('body-parser')
var multer  = require('multer');
let upload = multer();
var md5 = require('md5');

global.md5 = md5;


var app = express();
var api = require('./api');

// app.use(express.static('public'));
app.use(session({
    secret: 'sessiontest',//与cookieParser中的一致
    resave: true,
    saveUninitialized:true
}));

app.use(upload.fields([]));
app.use(bodyParser.json());
app.use(bodyParser.raw({type:"application/xml"}));
app.use(bodyParser.urlencoded({ extended: false }));

api(app);

var server = app.listen(8080, function() {
	console.log('开始启动服务器 8080');
});